package server;

import java.util.ArrayList;

/**
 * @file Resources.java
 * @version 0.1
 * @author James Dibble 10009689
 */
public class Resources {
    // <editor-fold defaultstate="collapsed" desc="Attributes">
    private static ArrayList<Resource> resources;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructors">
    public Resources() {
        resources = new ArrayList<>();
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    public void AddResource(Resource newResource){
        resources.add(newResource);
    }
    
    public Resource getResourceByID(int ID){
        for(Resource thisResource: resources){
            if(thisResource.getResourceID() == ID) return thisResource;
        }
        return null;
    }
    
    public String listResources(){
        String strTemp = "";
        for(Resource thisResource: resources){
            strTemp += String.format("%s. %s ",
                                     thisResource.getResourceID(),
                                     thisResource.getResourceName());
        }
        return strTemp;
    }
    // </editor-fold>
}
